

var global=[];
global["BD"] = browsersD();

// Xuong Defined
function browsersD(){
	var browsersD = {};
	var ua = navigator.userAgent;
	browsersD.MAC = (/Macintos/).test(ua);
	browsersD.WIN = (/Window/).test(ua);
	browsersD.SF = (/Safari/).test(ua);
	browsersD.FF = (/Mozilla/).test(ua);
	browsersD.Opera = (/Opera/).test(ua);
	browsersD.IE = (/MSIE/).test(ua);
	browsersD.IE6 = (/MSIE 6\.0/).test(ua);
	browsersD.IE7 = (/MSIE 7\.0/).test(ua);
	browsersD.IE8 = (/MSIE 8\.0/).test(ua);
	browsersD.iPad = navigator.userAgent.match(/iPad/i);
	browsersD.iPhone = navigator.userAgent.match(/iPhone/i);
	return browsersD;
}

/*if(navigator.userAgent.indexOf('Mac') != -1)

{document.write ('<link rel="stylesheet" type="text/css" href="inc-css/safari-os.css">');}*/

function addScroll(jScroll,iPadScrollbarClass){
	jQuery(jScroll).each(function(){
		var jscroll = jQuery(this);
		var botObj = jscroll.parent().next();
		var showMoreBtn = botObj.find(".ShowMoreBtn");
				
		if(global.BD.iPad){
			new iScroll(jscroll.attr("id"), {
				desktopCompatibility:true, 
				scrollbarClass: iPadScrollbarClass,
				onScrollEnd: function(isAtBottom) {
					if(showMoreBtn.length) {
						if(isAtBottom) {							
							botObj.removeClass("BottomBlockNone");
							showMoreBtn.addClass("Show");														
						}
						else {
							botObj.addClass("BottomBlockNone");
							showMoreBtn.removeClass("Show");
						}
					}
				}
			});
		}
		else {
			jscroll
				.bind(
					'jsp-scroll-y',
					function(event, scrollPositionY, isAtTop, isAtBottom) {
						if(showMoreBtn.length) {
							if(isAtBottom) {
									botObj.removeClass("BottomBlockNone");
									showMoreBtn.addClass("Show");
								}
							else {
								botObj.addClass("BottomBlockNone");
								showMoreBtn.removeClass("Show");
							}
						}
					}
				)
				.jScrollPane({
				verticalGutter: 0, //default is 4 - The amount of space between the side of the content and the vertical scrollbar.
				verticalDragMinHeight: 10
			});
		}
		
		var contentBlock = jscroll.closest('.scroll-content');
		var verticalBar = jscroll.find(".jspVerticalBar");
		verticalBar.hide();
		contentBlock.mouseenter(
		  function () {
			verticalBar.fadeIn();
		  }).mouseleave(function () {
			verticalBar.fadeOut();
		  });	
	})	
}	

/*browse button go*/
(function($) {
    
    $.fn.filestyle = function(options) {
                
        /* TODO: This should not override CSS. */
        var settings = {
            width : 250
        };
                
        if(options) {
            $.extend(settings, options);
        };
                        
        return this.each(function() {
            
            var self = this;
            var wrapper = $("<div>")
                            .css({
                                "width": settings.imagewidth + "px",
                                "height": settings.imageheight + "px",
                                "background": "url(" + settings.image + ") 0 0 no-repeat",
                                "background-position": "right",
                                "display": "inline",
                                "position": "absolute",
                                "overflow": "hidden"
                            });
                            
            var filename = $('<input class="file">')
                             .addClass($(self).attr("class"))
                             .css({
                                 "display": "inline",
                                 "width": settings.width + "px"
                             });

            $(self).before(filename);
            $(self).wrap(wrapper);

            $(self).css({
                        "position": "relative",
                        "height": settings.imageheight + "px",
                        "width": settings.width + "px",
                        "display": "inline",
                        "cursor": "pointer",
                        "opacity": "0.0"
                    });

            if ($.browser.mozilla) {
                if (/Win/.test(navigator.platform)) {
                    $(self).css("margin-left", "-142px");                    
                } else {
                    $(self).css("margin-left", "-168px");                    
                };
            } else {
                $(self).css("margin-left", settings.imagewidth - settings.width + "px");                
            };

            $(self).bind("change", function() {
                filename.val($(self).val());
            });
      
        });
        

    };
    
})(jQuery);
/*browse button go*/

/*ezmark min style check box go*/
(function($){$.fn.ezMark=function(options){options=options||{};var defaultOpt={checkboxCls:options.checkboxCls||'ez-checkbox',radioCls:options.radioCls||'ez-radio',checkedCls:options.checkedCls||'ez-checked',selectedCls:options.selectedCls||'ez-selected',hideCls:'ez-hide'};return this.each(function(){var $this=$(this);var wrapTag=$this.attr('type')=='checkbox'?'<div class="'+defaultOpt.checkboxCls+'">':'<div class="'+defaultOpt.radioCls+'">';if($this.attr('type')=='checkbox'){$this.addClass(defaultOpt.hideCls).wrap(wrapTag).change(function(){if($(this).is(':checked')){$(this).parent().addClass(defaultOpt.checkedCls);}
else{$(this).parent().removeClass(defaultOpt.checkedCls);}});if($this.is(':checked')){$this.parent().addClass(defaultOpt.checkedCls);}}
else if($this.attr('type')=='radio'){$this.addClass(defaultOpt.hideCls).wrap(wrapTag).change(function(){$('input[name="'+$(this).attr('name')+'"]').each(function(){if($(this).is(':checked')){$(this).parent().addClass(defaultOpt.selectedCls);}else{$(this).parent().removeClass(defaultOpt.selectedCls);}});});if($this.is(':checked')){$this.parent().addClass(defaultOpt.selectedCls);}}});}})(jQuery);
/*ezmark min style check box end*/

/*esasy slider go*/
(function(jQuery) {

	jQuery.fn.easySlider = function(options){
	  
		// default configuration properties
		var defaults = {			
			prevId: 		'prevBtn',
			prevText: 		'',
			nextId: 		'nextBtn',	
			nextText: 		'',
			controlsShow:	true,
			controlsBefore:	'',
			controlsAfter:	'',	
			controlsFade:	true,
			firstId: 		'firstBtn',
			firstText: 		'First',
			firstShow:		false,
			lastId: 		'lastBtn',	
			lastText: 		'Last',
			lastShow:		false,				
			vertical:		false,
			speed: 			800,
			auto:			false,
			pause:			2000,
			continuous:		false, 
			numeric: 		false,
			numericId: 		'controls'
		}; 
		
		var options = jQuery.extend(defaults, options);  
				
		this.each(function() {  
			var obj = $(this); 				
			var s = $("li", obj).length;
			var w = $("li", obj).width(); 
			var h = $("li", obj).height(); 
			var clickable = true;
			obj.width(w); 
			obj.height(h); 
			obj.css("overflow","hidden");
			var ts = s-1;
			var t = 0;
			jQuery("ul", obj).css('width',s*w);			
			
			if(options.continuous){
				jQuery("ul", obj).prepend(jQuery("ul li:last-child", obj).clone().css("margin-left","-"+ w +"px"));
				jQuery("ul", obj).append(jQuery("ul li:nth-child(2)", obj).clone());
				jQuery("ul", obj).css('width',(s+1)*w);
			};				
			
			if(!options.vertical) jQuery("li", obj).css('float','left');
								
			if(options.controlsShow){
				var html = options.controlsBefore;				
				if(options.numeric){
					html += '<ol id="'+ options.numericId +'"></ol>';
				} else {
					if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
					html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
					html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
					if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';				
				};
				
				html += options.controlsAfter;						
				jQuery(obj).after(html);										
			};
			
			if(options.numeric){									
				for(var i=0;i<s;i++){						
					jQuery(document.createElement("li"))
						.attr('id',options.numericId + (i+1))
						.html('<a rel='+ i +' href=\"javascript:void(0);\">'+ (i+1) +'</a>')
						.appendTo(jQuery("#"+ options.numericId))
						.click(function(){							
							animate(jQuery("a",jQuery(this)).attr('rel'),true);
						}); 												
				};							
			} else {
				jQuery("a","#"+options.nextId).click(function(){		
					animate("next",true);
				});
				jQuery("a","#"+options.prevId).click(function(){		
					animate("prev",true);				
				});	
				jQuery("a","#"+options.firstId).click(function(){		
					animate("first",true);
				});				
				jQuery("a","#"+options.lastId).click(function(){		
					animate("last",true);				
				});				
			};
			
			function setCurrent(i){
				i = parseInt(i)+1;
				jQuery("li", "#" + options.numericId).removeClass("current");
				jQuery("li#" + options.numericId + i).addClass("current");
			};
			
			function adjust(){
				if(t>ts) t=0;		
				if(t<0) t=ts;	
				if(!options.vertical) {
					jQuery("ul",obj).css("margin-left",(t*w*-1));
				} else {
					jQuery("ul",obj).css("margin-left",(t*h*-1));
				}
				clickable = true;
				if(options.numeric) setCurrent(t);
			};
			
			function animate(dir,clicked){
				if (clickable){
					clickable = false;
					var ot = t;				
					switch(dir){
						case "next":
							t = (ot>=ts) ? (options.continuous ? t+1 : ts) : t+1;						
							break; 
						case "prev":
							t = (t<=0) ? (options.continuous ? t-1 : 0) : t-1;
							break; 
						case "first":
							t = 0;
							break; 
						case "last":
							t = ts;
							break; 
						default:
							t = dir;
							break; 
					};	
					var diff = Math.abs(ot-t);
					var speed = diff*options.speed;						
					if(!options.vertical) {
						p = (t*w*-1);
						jQuery("ul",obj).animate(
							{ marginLeft: p }, 
							{ queue:false, duration:speed, complete:adjust }
						);				
					} else {
						p = (t*h*-1);
						jQuery("ul",obj).animate(
							{ marginTop: p }, 
							{ queue:false, duration:speed, complete:adjust }
						);					
					};
					
					if(!options.continuous && options.controlsFade){					
						if(t==ts){
							jQuery("a","#"+options.nextId).hide();
							jQuery("a","#"+options.lastId).hide();
						} else {
							jQuery("a","#"+options.nextId).show();
							jQuery("a","#"+options.lastId).show();					
						};
						if(t==0){
							jQuery("a","#"+options.prevId).hide();
							jQuery("a","#"+options.firstId).hide();
						} else {
							jQuery("a","#"+options.prevId).show();
							jQuery("a","#"+options.firstId).show();
						};					
					};				
					
					if(clicked) clearTimeout(timeout);
					if(options.auto && dir=="next" && !clicked){;
						timeout = setTimeout(function(){
							animate("next",false);
						},diff*options.speed+options.pause);
					};
			
				};
				
			};
			// init
			var timeout;
			if(options.auto){;
				timeout = setTimeout(function(){
					animate("next",false);
				},options.pause);
			};		
			
			if(options.numeric) setCurrent(0);
		
			if(!options.continuous && options.controlsFade){					
				jQuery("a","#"+options.prevId).hide();
				jQuery("a","#"+options.firstId).hide();				
			};				
			
		});
	  
	};

})(jQuery);
/*esasy slider end*/

/*colorbox go*/
// ColorBox v1.3.18 - a full featured, light-weight, customizable lightbox based on jQuery 1.3+
// Copyright (c) 2011 Jack Moore - jack@colorpowered.com
// Licensed under the MIT license: http://www.opensource.org/licenses/mit-license.php
(function(a,b,c){function Y(c,d,e){var g=b.createElement(c);return d&&(g.id=f+d),e&&(g.style.cssText=e),a(g)}function Z(a){var b=y.length,c=(Q+a)%b;return c<0?b+c:c}function $(a,b){return Math.round((/%/.test(a)?(b==="x"?z.width():z.height())/100:1)*parseInt(a,10))}function _(a){return K.photo||/\.(gif|png|jpe?g|bmp|ico)((#|\?).*)?$/i.test(a)}function ba(){var b;K=a.extend({},a.data(P,e));for(b in K)a.isFunction(K[b])&&b.slice(0,2)!=="on"&&(K[b]=K[b].call(P));K.rel=K.rel||P.rel||"nofollow",K.href=K.href||a(P).attr("href"),K.title=K.title||P.title,typeof K.href=="string"&&(K.href=a.trim(K.href))}function bb(b,c){a.event.trigger(b),c&&c.call(P)}function bc(){var a,b=f+"Slideshow_",c="click."+f,d,e,g;K.slideshow&&y[1]?(d=function(){F.text(K.slideshowStop).unbind(c).bind(j,function(){if(Q<y.length-1||K.loop)a=setTimeout(W.next,K.slideshowSpeed)}).bind(i,function(){clearTimeout(a)}).one(c+" "+k,e),r.removeClass(b+"off").addClass(b+"on"),a=setTimeout(W.next,K.slideshowSpeed)},e=function(){clearTimeout(a),F.text(K.slideshowStart).unbind([j,i,k,c].join(" ")).one(c,function(){W.next(),d()}),r.removeClass(b+"on").addClass(b+"off")},K.slideshowAuto?d():e()):r.removeClass(b+"off "+b+"on")}function bd(b){if(!U){P=b,ba(),y=a(P),Q=0,K.rel!=="nofollow"&&(y=a("."+g).filter(function(){var b=a.data(this,e).rel||this.rel;return b===K.rel}),Q=y.index(P),Q===-1&&(y=y.add(P),Q=y.length-1));if(!S){S=T=!0,r.show();if(K.returnFocus)try{P.blur(),a(P).one(l,function(){try{this.focus()}catch(a){}})}catch(c){}q.css({opacity:+K.opacity,cursor:K.overlayClose?"pointer":"auto"}).show(),K.w=$(K.initialWidth,"x"),K.h=$(K.initialHeight,"y"),W.position(),o&&z.bind("resize."+p+" scroll."+p,function(){q.css({width:z.width(),height:z.height(),top:z.scrollTop(),left:z.scrollLeft()})}).trigger("resize."+p),bb(h,K.onOpen),J.add(D).hide(),I.html(K.close).show()}W.load(!0)}}var d={transition:"elastic",speed:300,width:!1,initialWidth:"600",innerWidth:!1,maxWidth:!1,height:!1,initialHeight:"450",innerHeight:!1,maxHeight:!1,scalePhotos:!0,scrolling:!0,inline:!1,html:!1,iframe:!1,fastIframe:!0,photo:!1,href:!1,title:!1,rel:!1,opacity:.9,preloading:!0,current:"image {current} of {total}",previous:"previous",next:"next",close:"close",open:!1,returnFocus:!0,loop:!0,slideshow:!1,slideshowAuto:!0,slideshowSpeed:2500,slideshowStart:"start slideshow",slideshowStop:"stop slideshow",onOpen:!1,onLoad:!1,onComplete:!1,onCleanup:!1,onClosed:!1,overlayClose:!0,escKey:!0,arrowKey:!0,top:!1,bottom:!1,left:!1,right:!1,fixed:!1,data:undefined},e="colorbox",f="cbox",g=f+"Element",h=f+"_open",i=f+"_load",j=f+"_complete",k=f+"_cleanup",l=f+"_closed",m=f+"_purge",n=a.browser.msie&&!a.support.opacity,o=n&&a.browser.version<7,p=f+"_IE6",q,r,s,t,u,v,w,x,y,z,A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X="div";W=a.fn[e]=a[e]=function(b,c){var f=this;b=b||{},W.init();if(!f[0]){if(f.selector)return f;f=a("<a/>"),b.open=!0}return c&&(b.onComplete=c),f.each(function(){a.data(this,e,a.extend({},a.data(this,e)||d,b)),a(this).addClass(g)}),(a.isFunction(b.open)&&b.open.call(f)||b.open)&&bd(f[0]),f},W.init=function(){if(!r){if(!a("body")[0]){a(W.init);return}z=a(c),r=Y(X).attr({id:e,"class":n?f+(o?"IE6":"IE"):""}),q=Y(X,"Overlay",o?"position:absolute":"").hide(),s=Y(X,"Wrapper"),t=Y(X,"Content").append(A=Y(X,"LoadedContent","width:0; height:0; overflow:hidden"),C=Y(X,"LoadingOverlay").add(Y(X,"LoadingGraphic")),D=Y(X,"Title"),E=Y(X,"Current"),G=Y(X,"Next"),H=Y(X,"Previous"),F=Y(X,"Slideshow").bind(h,bc),I=Y(X,"Close")),s.append(Y(X).append(Y(X,"TopLeft"),u=Y(X,"TopCenter"),Y(X,"TopRight")),Y(X,!1,"clear:left").append(v=Y(X,"MiddleLeft"),t,w=Y(X,"MiddleRight")),Y(X,!1,"clear:left").append(Y(X,"BottomLeft"),x=Y(X,"BottomCenter"),Y(X,"BottomRight"))).find("div div").css({"float":"left"}),B=Y(X,!1,"position:absolute; width:9999px; visibility:hidden; display:none"),a("body").prepend(q,r.append(s,B)),L=u.height()+x.height()+t.outerHeight(!0)-t.height(),M=v.width()+w.width()+t.outerWidth(!0)-t.width(),N=A.outerHeight(!0),O=A.outerWidth(!0),r.css({"padding-bottom":L,"padding-right":M}).hide(),G.click(function(){W.next()}),H.click(function(){W.prev()}),I.click(function(){W.close()}),J=G.add(H).add(E).add(F),q.click(function(){K.overlayClose&&W.close()}),a(b).bind("keydown."+f,function(a){var b=a.keyCode;S&&K.escKey&&b===27&&(a.preventDefault(),W.close()),S&&K.arrowKey&&y[1]&&(b===37?(a.preventDefault(),H.click()):b===39&&(a.preventDefault(),G.click()))})}},W.remove=function(){r.add(q).remove(),r=null,a("."+g).removeData(e).removeClass(g)},W.position=function(a,b){function g(a){u[0].style.width=x[0].style.width=t[0].style.width=a.style.width,C[0].style.height=C[1].style.height=t[0].style.height=v[0].style.height=w[0].style.height=a.style.height}var c=0,d=0,e=r.offset();z.unbind("resize."+f),r.css({top:-99999,left:-99999}),K.fixed&&!o?r.css({position:"fixed"}):(c=z.scrollTop(),d=z.scrollLeft(),r.css({position:"absolute"})),K.right!==!1?d+=Math.max(z.width()-K.w-O-M-$(K.right,"x"),0):K.left!==!1?d+=$(K.left,"x"):d+=Math.round(Math.max(z.width()-K.w-O-M,0)/2),K.bottom!==!1?c+=Math.max(z.height()-K.h-N-L-$(K.bottom,"y"),0):K.top!==!1?c+=$(K.top,"y"):c+=Math.round(Math.max(z.height()-K.h-N-L,0)/2),r.css({top:e.top,left:e.left}),a=r.width()===K.w+O&&r.height()===K.h+N?0:a||0,s[0].style.width=s[0].style.height="9999px",r.dequeue().animate({width:K.w+O,height:K.h+N,top:c,left:d},{duration:a,complete:function(){g(this),T=!1,s[0].style.width=K.w+O+M+"px",s[0].style.height=K.h+N+L+"px",b&&b(),setTimeout(function(){z.bind("resize."+f,W.position)},1)},step:function(){g(this)}})},W.resize=function(a){S&&(a=a||{},a.width&&(K.w=$(a.width,"x")-O-M),a.innerWidth&&(K.w=$(a.innerWidth,"x")),A.css({width:K.w}),a.height&&(K.h=$(a.height,"y")-N-L),a.innerHeight&&(K.h=$(a.innerHeight,"y")),!a.innerHeight&&!a.height&&(A.css({height:"auto"}),K.h=A.height()),A.css({height:K.h}),W.position(K.transition==="none"?0:K.speed))},W.prep=function(b){function g(){return K.w=K.w||A.width(),K.w=K.mw&&K.mw<K.w?K.mw:K.w,K.w}function h(){return K.h=K.h||A.height(),K.h=K.mh&&K.mh<K.h?K.mh:K.h,K.h}if(!S)return;var c,d=K.transition==="none"?0:K.speed;A.remove(),A=Y(X,"LoadedContent").append(b),A.hide().appendTo(B.show()).css({width:g(),overflow:K.scrolling?"auto":"hidden"}).css({height:h()}).prependTo(t),B.hide(),a(R).css({"float":"none"}),o&&a("select").not(r.find("select")).filter(function(){return this.style.visibility!=="hidden"}).css({visibility:"hidden"}).one(k,function(){this.style.visibility="inherit"}),c=function(){function q(){n&&r[0].style.removeAttribute("filter")}var b,c,g=y.length,h,i="frameBorder",k="allowTransparency",l,o,p;if(!S)return;l=function(){clearTimeout(V),C.hide(),bb(j,K.onComplete)},n&&R&&A.fadeIn(100),D.html(K.title).add(A).show();if(g>1){typeof K.current=="string"&&E.html(K.current.replace("{current}",Q+1).replace("{total}",g)).show(),G[K.loop||Q<g-1?"show":"hide"]().html(K.next),H[K.loop||Q?"show":"hide"]().html(K.previous),K.slideshow&&F.show();if(K.preloading){b=[Z(-1),Z(1)];while(c=y[b.pop()])o=a.data(c,e).href||c.href,a.isFunction(o)&&(o=o.call(c)),_(o)&&(p=new Image,p.src=o)}}else J.hide();K.iframe?(h=Y("iframe")[0],i in h&&(h[i]=0),k in h&&(h[k]="true"),h.name=f+ +(new Date),K.fastIframe?l():a(h).one("load",l),h.src=K.href,K.scrolling||(h.scrolling="no"),a(h).addClass(f+"Iframe").appendTo(A).one(m,function(){h.src="//about:blank"})):l(),K.transition==="fade"?r.fadeTo(d,1,q):q()},K.transition==="fade"?r.fadeTo(d,0,function(){W.position(0,c)}):W.position(d,c)},W.load=function(b){var c,d,e=W.prep;T=!0,R=!1,P=y[Q],b||ba(),bb(m),bb(i,K.onLoad),K.h=K.height?$(K.height,"y")-N-L:K.innerHeight&&$(K.innerHeight,"y"),K.w=K.width?$(K.width,"x")-O-M:K.innerWidth&&$(K.innerWidth,"x"),K.mw=K.w,K.mh=K.h,K.maxWidth&&(K.mw=$(K.maxWidth,"x")-O-M,K.mw=K.w&&K.w<K.mw?K.w:K.mw),K.maxHeight&&(K.mh=$(K.maxHeight,"y")-N-L,K.mh=K.h&&K.h<K.mh?K.h:K.mh),c=K.href,V=setTimeout(function(){C.show()},100),K.inline?(Y(X).hide().insertBefore(a(c)[0]).one(m,function(){a(this).replaceWith(A.children())}),e(a(c))):K.iframe?e(" "):K.html?e(K.html):_(c)?(a(R=new Image).addClass(f+"Photo").error(function(){K.title=!1,e(Y(X,"Error").text("This image could not be loaded"))}).load(function(){var a;R.onload=null,K.scalePhotos&&(d=function(){R.height-=R.height*a,R.width-=R.width*a},K.mw&&R.width>K.mw&&(a=(R.width-K.mw)/R.width,d()),K.mh&&R.height>K.mh&&(a=(R.height-K.mh)/R.height,d())),K.h&&(R.style.marginTop=Math.max(K.h-R.height,0)/2+"px"),y[1]&&(Q<y.length-1||K.loop)&&(R.style.cursor="pointer",R.onclick=function(){W.next()}),n&&(R.style.msInterpolationMode="bicubic"),setTimeout(function(){e(R)},1)}),setTimeout(function(){R.src=c},1)):c&&B.load(c,K.data,function(b,c,d){e(c==="error"?Y(X,"Error").text("Request unsuccessful: "+d.statusText):a(this).contents())})},W.next=function(){!T&&y[1]&&(Q<y.length-1||K.loop)&&(Q=Z(1),W.load())},W.prev=function(){!T&&y[1]&&(Q||K.loop)&&(Q=Z(-1),W.load())},W.close=function(){S&&!U&&(U=!0,S=!1,bb(k,K.onCleanup),z.unbind("."+f+" ."+p),q.fadeTo(200,0),r.stop().fadeTo(300,0,function(){r.add(q).css({opacity:1,cursor:"auto"}).hide(),bb(m),A.remove(),setTimeout(function(){U=!1,bb(l,K.onClosed)},1)}))},W.element=function(){return a(P)},W.settings=d,a("."+g,b).live("click",function(a){a.which>1||a.shiftKey||a.altKey||a.metaKey||(a.preventDefault(),bd(this))}),W.init()})(jQuery,document,this);
/*colorbox end*/

function addForex(id) {
	var table = "<table cellspacing='1px' cellpadding='2px' border='0px' class='tbl-forex'><tbody>";
	for(i=0; i<10; i++) {
		table += "<tr><td class='td-forex-title'>" + vForexs[i] + "</td><td class='td-forex-data txtr'>" + vCosts[i] + "</td></tr>";
	}
	table += "</tbody></table>";
	jQuery("#" + id).append(table);
}

function addWeather(id) {
	jQuery("#" + id + " > iframe").attr("src", "http://www.thienduongweb.com/tool/weather/?size=180&fsize=12&r=0&w=1&g=0");
}
jQuery(document).ready(function() {	
	addScroll(".scroll-pane", "myScrollbar");
	addScroll(".item-detail", "myScrollbar");
	
	addForex("eForex");
	addWeather("weather");
	
	jQuery("#nav_" + jQuery("#category").val()).addClass("current");
	
	jQuery("#backToTop").click(function(){
		window.scrollTo(0,0); 
	});
	jQuery("#search_text").click(function() {
		jQuery(this).val('');
	});
	jQuery("#search > a").click(function() {
		jQuery(this).attr("href", jQuery("#siteURL").val() + "product/search/" + jQuery("#search_text").val());
	});
	
	/* VIDEO */
	jQuery("#video").html("");
	var flashvars = {
		mainURL: jQuery("#siteURL").val() + "themes/default/video/fb_vplayer_2.swf",
		autoPlay: 'false',
		videoURL: jQuery("#siteURL").val() + "themes/default/video/video.flv"
	};
	var params = {
		menu: "false",
		scale: "noScale",
		allowFullscreen: "true",
		allowScriptAccess: "always",
		bgcolor: "#000000",
		wmode: "transparent"
	};
	swfobject.embedSWF(jQuery("#siteURL").val() + "themes/default/video/fb_preloader_2.swf", "video", "260", "205", "10.0.0", jQuery("#siteURL").val() + "themes/default/video/expressInstall.swf", flashvars, params);
	
	/*
	var h = jQuery(document).height();
	var w = jQuery(document).width();
	jQuery(".BgPage").css("height",1000);	
	jQuery(".BgPage").css("width",w);	
	jQuery("#container").css("height",1000);	
	if(w <= 1024){
		jQuery("#wrapperBlock").css("margin-left",14);
		jQuery(".Auto4").css("width",15);
		if(global.BD.iPad){
			jQuery("#wrapperBlock").css("margin-left",22);
			jQuery(".Scroller ul").css("overflow","hidden");
		}
	}
	
	
	
	if(jQuery(".Inbox").length > 0){
		jQuery(".Inbox").click(function(){
			jQuery(this).next(".ListMess").slideDown();
			var w = jQuery(".titleH").width();
			jQuery(".ListMess").css("left", w + 6);
		});	
	}
	
	if(jQuery(".LinkHd").length > 0){
		jQuery(".LinkHd").click(function(event){
			event.preventDefault();
			if(jQuery(".LinkHd").hasClass("Action")){
				jQuery(".ListType02").slideUp();	
				jQuery(".Overlay").removeClass("Show");
				jQuery(this).removeClass("Action");
			}else{
				jQuery(this).addClass("Action");							 
				jQuery(".ListType02").slideDown();	
				jQuery(".Overlay").addClass("Show");
				
				 if(jQuery(".Overlay").hasClass("Show")){
					var h = jQuery(document).height() - 48;
					jQuery(".Overlay").css("height", h) ;
				 }	
			}
		
		});	
		jQuery(".Cancel").click(function(){
			jQuery(".ListType02").slideUp();	
			jQuery(".Overlay").removeClass("Show");
			jQuery(".LinkHd").removeClass("Action");							 
		})
		
	}
	
	 jQuery(".FillColorT").each(function(index){
        jQuery(this).css("z-index", "10" - index);
      });
	 
	 
	
		jQuery("body").click(function(e) {
			if (jQuery(e.target).closest(".titleH, .ListType, .Filter, .ListType01, #ui-datepicker-div, .ui-datepicker-prev, .ui-datepicker-next").size() == 0) {
				jQuery(".ListType, .ListType01").slideUp();	
				jQuery(".titleH, .Filter").removeClass("show");
			}
			if (jQuery(e.target).closest(".Inbox").size() == 0) {
				jQuery(".ListMess").slideUp();	
			}
			if (jQuery(e.target).closest(".Filter, .ListType01, #ui-datepicker-div, .ui-datepicker-prev, .ui-datepicker-next").size() == 0) {
				jQuery(".ListType01").slideUp();	
			}
		});
	//, #header .ListType02 p input
	jQuery('.Row input').ezMark();
	
	$("input.file_1").filestyle({ 
          image: "images/btn-browse.png",
          imageheight : 20,
          imagewidth : 70,
          width : 100
      });
	
	//right align
	jQuery(".BlockLeft .GoDetail").click(function(e){
		if(!jQuery(".DetailRight").hasClass("Show")){
			jQuery(".DetailRight").addClass("Show");
			jQuery(".BlockRight").addClass("Hide");	
			addScroll(".ScrollPane", "myScrollbar");
		}else{
			addScroll(".ScrollPane", "myScrollbar");
		}
		e.preventDefault();
	});
	jQuery(".DetailRight .Close").click(function(e){
		if(jQuery(".DetailRight").hasClass("Show")){	
			jQuery(".DetailRight").removeClass("Show");
			jQuery(".BlockRight").removeClass("Hide");
			jQuery(".DetailRight").removeClass("Resulted");
			addScroll(".ScrollPane", "myScrollbar");
		}else{
			addScroll(".ScrollPane", "myScrollbar");
		}
		e.preventDefault();
	});
	//left align
	jQuery(".BlockRight .GoDetail").click(function(){
		if(!jQuery(".DetailLeft").hasClass("Show")){
			jQuery(".DetailLeft").addClass("Show");
			jQuery(".BlockLeft").addClass("Hide");	
			addScroll(".ScrollPane", "myScrollbar");
		}else{
			addScroll(".ScrollPane", "myScrollbar");
		}
		
	});
	jQuery(".DetailLeft .Close").click(function(){
		if(jQuery(".DetailLeft").hasClass("Show")){	
			jQuery(".DetailLeft").removeClass("Show");
			jQuery(".BlockLeft").removeClass("Hide");
			addScroll(".ScrollPane", "myScrollbar");
		}else{
			addScroll(".ScrollPane", "myScrollbar");
		}
	});
	
	$(".VideoTh > a").bind("click",function() {
		if (!jQuery(this).hasClass("Clicked")) {
			jQuery(".VideoTh > a").removeClass("Clicked");
			jQuery(this).addClass("Clicked");
			jQuery(".PicB").removeClass("Active");							
			jQuery("#"+ $(this).attr("rel")).addClass("Active");
		}
		return false;
	});
	
	// apply carousel
	if(jQuery('#mycarousel').length) {
		jQuery('#mycarousel').jcarousel({
			visible: 1,
			scroll: 1
		});
	}
	
	// set height
	if(jQuery('.BOBodyBlockEqualH').length) {
		var h_max = 0;
		jQuery(".BOBodyBlockEqualH").each(function() {
			var h_it = jQuery(this).height();
			if (h_max < h_it) h_max = h_it;
		});
		
		jQuery(".BOBodyBlockEqualH").each(function() {
			jQuery(this).height(h_max);
		});
		if(jQuery(".BOBodyBlockEqualH").hasClass("Pass")){
			jQuery(".Pass").css("height", jQuery(".Pass").height() - 29);
		}
	}
	jQuery(".ShowMoreBtn").click(function(event){	
		event.preventDefault();
		var ID = $(this).attr("rel");
		jQuery("#"+ID).append("<div class='Loadding'><img src='./images/loading.gif' /></div>");
		jQuery.ajax({
		  url: "append-to-list.html",
		  data: ID,
	 	 success: function(data) {
		jQuery("#"+ID).find(".ListNews").append(data);
		
		setTimeout(function(){jQuery("#"+ID).find(".Loadding").fadeOut();}, 1000);
		addScroll(".ScrollPane", "myScrollbar");
	  	}
		});
	});
	jQuery(".ShowMoreBtn").click(function(event){
		event.preventDefault();
		var ID = $(this).attr("rel");
		jQuery("#"+ID).append("<div class='Loadding'><img src='./images/loading.gif' /></div>");
		jQuery.ajax({
		  url: "append-to-photo.html",
		  data: ID,
	 	 success: function(data) {
		jQuery("#"+ID).find(".DefaultList").append(data);
		setTimeout(function(){jQuery("#"+ID).find(".Loadding").fadeOut();}, 1000);
		addScroll(".ScrollPane", "myScrollbar");
	  	}
		});
	});
	
	if(jQuery(".LinkHd").text() == ""){
		jQuery(".LinkHd").addClass("Hide");
	}else{
		jQuery(".LinkHd").removeClass("Hide");
	}
	if(jQuery("#slider").length > 0){
		jQuery("#slider").easySlider({
			auto: false,
			continuous: true 
		});
	}
	if(jQuery(".GoEmail").length > 0) {
		
		jQuery(".GoEmail").colorbox({
		onLoad:function(){jQuery('#cboxClose').hide(); },
		onComplete:function(){
		jQuery('#cboxClose').fadeIn(1500);	
		addScroll(".ScrollPane", "myScrollbar");
		}});
		jQuery(".CloseLb").live('click', function(){
		 jQuery.fn.colorbox.close();
		});
	}

	if(jQuery(".GoQuestion").length > 0) {
		jQuery(".GoQuestion").colorbox({
		onLoad:function(){jQuery('#cboxClose').hide(); },
		onComplete:function(){
		jQuery('#cboxClose').fadeIn(1500);	
		}});
		jQuery(".CloseLb").live('click', function(){
		 jQuery.fn.colorbox.close();
		});
	}
	if(jQuery(".GoPrint").length > 0) {
		
		jQuery(".GoPrint").colorbox({
		onLoad:function(){jQuery('#cboxClose').hide(); },
		onComplete:function(){
			jQuery('#cboxClose').fadeIn(1500);	
			addScroll(".ScrollPane", "myScrollbar");
			
		}});
		jQuery(".CloseLb").live('click', function(){
		 jQuery.fn.colorbox.close();
		});
	}
	if(jQuery(".Result").length > 0) {
		jQuery(".Result").mouseenter(function(){
			jQuery(this).find(".ListDownload").show();									  
		})
		jQuery(".Result").mouseleave(function(){
			jQuery(this).find(".ListDownload").hide();									  
		})		
	}
	if(jQuery(".Style01CoverTypeTBC").length > 0) {
		jQuery(".Style01CoverTypeTBC").mouseenter(function(){
			jQuery(this).find(".Note").show();									  
		})
		jQuery(".Style01CoverTypeTBC").mouseleave(function(){
			jQuery(this).find(".Note").hide();									  
		})		
	}
	if(jQuery(".HasTooltip").length > 0) {
		jQuery(".HasTooltip").mouseenter(function(){
			jQuery(this).find(".NoteKey").show();									  
		})
		jQuery(".HasTooltip").mouseleave(function(){
			jQuery(this).find(".NoteKey").hide();									  
		})		
	}
	if(jQuery(".NameAu").length > 0) {
		jQuery(".NameAu").mouseenter(function(){
			jQuery(this).find(".InfoAu").show();									  
		})
		jQuery(".NameAu").mouseleave(function(){
			jQuery(this).find(".InfoAu").hide();									  
		})		
	}
	if(jQuery(".TextArea").length > 0){
		var ht = jQuery(".TextArea").parents(".ScrollPane").height();
		jQuery(".TextArea").css("height", ht - 70);
	}
	jQuery(".Resulted").click(function(){
		var rel = jQuery(this).attr("rel");	
		jQuery(".DetailRight").addClass(rel);	
	});
	
	$( "#datepickerFrom, #datepickerFrom01, #datepickerFrom02, #datepickerFrom03" ).datepicker({
			showOn: "button",
			buttonImage: "./images/icon-cal.png",
			buttonImageOnly: true
});		
		$( "#datepickerTo, #datepickerTo01, , #datepickerTo02, , #datepickerTo03" ).datepicker({
			showOn: "button",
			buttonImage: "./images/icon-cal.png",
			buttonImageOnly: true
		});
	// Focus Key word							
	var tempIT = jQuery(".TxtFocus");
		if(tempIT.length) inputText(".TxtFocus","");
	// Google map
	if(jQuery("#myMap").length > 0) {	
		var googlemap = new initializeGM(10.7959197, 106.655409, "myMap");
	}
*/	
});

function inputText(cssSel,NewInputClass){

	jQuery(cssSel).each(function(){
		var tagName = this.tagName.toLowerCase();
		var tempString = "";
		if(tagName=="textarea")
			tempString = this.title;
		else if(tagName=="input") {			
			tempString = this.alt;
		}	
		if(tempString!="")
		{
			jQuery(this).bind("blur",function(){
				if(jQuery(this).val()=="")
				{
					jQuery(this).val(tempString);
					jQuery(this).addClass(NewInputClass);
				}
			}).bind("focus",function(){
				if(jQuery(this).val()==tempString)
				{
					jQuery(this).val("");
					jQuery(this).removeClass(NewInputClass);
				}
			});
		}
	});
 }